﻿#region Header
// ------------------------ Licence / Copyright ------------------------
// 
// ScrumTable for Scrum Meeting Support
// Copyright © HSR - Hochschule für Technik Rapperswil
// All Rights Reserved
// 
// Author:
//  Michael Gfeller Silvan Gehrig Patrick Boos
// 
// ---------------------------------------------------------------------
#endregion

#region Usings

using System.Collections.Generic;
using System.ComponentModel;

#endregion

namespace ScrumTable.BL.DM.DataManagement
{
    /// <summary>
    /// Represents the an event arguments class which contains additional
    /// information about an event if something has changed inside a
    /// domain object.
    /// </summary>
    public class MultipleDomainChangingEventArgs : DomainChangingEventArgs
    {
        #region Declarations
        //--------------------------------------------------------------------
        // Declarations
        //--------------------------------------------------------------------

        private readonly IList<DomainChangingEventArgs> _children = new List<DomainChangingEventArgs>();

        #endregion

        #region Properties
        //--------------------------------------------------------------------
        // Properties
        //--------------------------------------------------------------------

        /// <summary>
        /// Gets the child event argument instances.
        /// </summary>
        public IEnumerable<DomainChangingEventArgs> Children
        {
            get { return _children; }
        }

        /// <summary>
        /// Gets the number of child event listed in the current MultipleDomainChangingEventArgs instance.
        /// </summary>
        public int EventCount
        {
            get { return _children.Count; }
        }

        #endregion

        #region Constructors / Destructor
        //--------------------------------------------------------------------
        // Constructors / Destructor
        //--------------------------------------------------------------------

        /// <summary>
        /// Creates a new MultipleDomainChangingEventArgs instance. This constructor
        /// is protected internal because its needed by derived or package classes only.
        /// </summary>
        internal protected MultipleDomainChangingEventArgs()
            : base(string.Empty)
        {
        }

        #endregion

        #region Methods
        //--------------------------------------------------------------------
        // Methods
        //--------------------------------------------------------------------

        /// <summary>
        /// Adds a child event to the current event argument.
        /// </summary>
        /// <param name="toAdd">Specifies the child event to add.</param>
        internal void Add(DomainChangingEventArgs toAdd)
        {
            if (toAdd != null)
                _children.Add(toAdd);
        }

        #endregion

        #region Events
        //--------------------------------------------------------------------
        // Events
        //--------------------------------------------------------------------

        #endregion
    }
}